package com.video.system.service.impl;

import java.util.List;
import com.video.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.video.system.mapper.VideoAdvertisingMapper;
import com.video.system.domain.VideoAdvertising;
import com.video.system.service.IVideoAdvertisingService;
import com.video.common.core.text.Convert;

/**
 * 广告Service业务层处理
 * 
 * @author lyh
 * @date 2021-07-21
 */
@Service
public class VideoAdvertisingServiceImpl implements IVideoAdvertisingService 
{
    @Autowired
    private VideoAdvertisingMapper videoAdvertisingMapper;

    /**
     * 查询广告
     * 
     * @param advertisingId 广告ID
     * @return 广告
     */
    @Override
    public VideoAdvertising selectVideoAdvertisingById(Integer advertisingId)
    {
        return videoAdvertisingMapper.selectVideoAdvertisingById(advertisingId);
    }

    /**
     * 查询广告列表
     * 
     * @param videoAdvertising 广告
     * @return 广告
     */
    @Override
    public List<VideoAdvertising> selectVideoAdvertisingList(VideoAdvertising videoAdvertising)
    {
        return videoAdvertisingMapper.selectVideoAdvertisingList(videoAdvertising);
    }

    /**
     * 新增广告
     * 
     * @param videoAdvertising 广告
     * @return 结果
     */
    @Override
    public int insertVideoAdvertising(VideoAdvertising videoAdvertising)
    {
        videoAdvertising.setCreateTime(DateUtils.getNowDate());
        return videoAdvertisingMapper.insertVideoAdvertising(videoAdvertising);
    }

    /**
     * 修改广告
     * 
     * @param videoAdvertising 广告
     * @return 结果
     */
    @Override
    public int updateVideoAdvertising(VideoAdvertising videoAdvertising)
    {
        videoAdvertising.setUpdateTime(DateUtils.getNowDate());
        return videoAdvertisingMapper.updateVideoAdvertising(videoAdvertising);
    }

    /**
     * 删除广告对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteVideoAdvertisingByIds(String ids)
    {
        return videoAdvertisingMapper.deleteVideoAdvertisingByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除广告信息
     * 
     * @param advertisingId 广告ID
     * @return 结果
     */
    @Override
    public int deleteVideoAdvertisingById(Integer advertisingId)
    {
        return videoAdvertisingMapper.deleteVideoAdvertisingById(advertisingId);
    }
}
